package com.yun.many.auth.service.impl;

import com.yun.many.auth.dao.entity.Role;
import com.yun.many.auth.dao.service.IRoleRepository;
import com.yun.many.auth.model.req.RoleEditReq;
import com.yun.many.auth.service.IRoleService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import static com.yun.many.auth.model.translator.RoleTranslator.toEntity;

@Service
@RequiredArgsConstructor
public class RoleServiceImpl implements IRoleService {

    private final IRoleRepository roleRepository;

    @Override
    public Boolean add(RoleEditReq req) {
        Role entity = toEntity(req);
        return roleRepository.saveOrUpdate(entity);
    }
}
